Add install rules and system-sodium option for packaging#153
Merged
Conversation
Enables distribution via package managers such as homebrew. No change to the default developer build (static, vendored sodium). - project() now carries a version (1.3.1); libnetcode gets VERSION / SOVERSION for proper shared-library symlinks. - NETCODE_SYSTEM_SODIUM=ON links the system libsodium via find_library instead of the vendored copy (the two are interchangeable — the vendored subset is a byte-identical slice of upstream). Package managers prefer this so their libsodium supplies the crypto and gets security updates. - BUILD_SHARED_LIBS is now honored; vendored sodium objects are built position-independent so they fold into a shared libnetcode. - NETCODE_INSTALL (default ON) generates an install target for netcode.h and the library, using GNUInstallDirs. - CI: new ubuntu system-sodium leg builds shared against libsodium-dev, runs the tests, installs, and checks the layout. - BUILDING.md / CLAUDE.md document the packaging options. Verified locally: default, system-sodium (static + shared) against homebrew libsodium 1.0.22, staged install, and a standalone consumer program compiled against only the installed header + shared library. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Groundwork for distributing netcode through package managers (homebrew, apt, vcpkg, …). No change to the default developer build — still static, still vendored sodium, still
cmake -B build && cmake --build build.project()carries a version (1.3.1);libnetcodegetsVERSION/SOVERSIONfor shared-library symlinks.-DNETCODE_SYSTEM_SODIUM=ONlinks the system libsodium (find_library) instead of the vendored copy — interchangeable, since the vendored subset is a byte-identical slice of upstream. Package managers want this so their libsodium owns the crypto and its security updates.-DBUILD_SHARED_LIBS=ONnow works; vendored sodium objects are built PIC so they fold into a sharedlibnetcode.cmake --installinstallsnetcode.h+ the library viaGNUInstallDirs(NETCODE_INSTALL=OFFto disable when embedding).system-sodiumleg builds shared againstlibsodium-dev, tests, installs, and asserts the install layout.Verification (local, macOS Apple Silicon)
otool -Lconfirms it links the homebrew dylib.cmake --install: producesinclude/netcode.h+lib/libnetcode.{1.3.1.dylib,1.dylib,dylib}.Homebrew — next step (needs maintainer)
This PR is the prerequisite. Once merged and a v1.3.1 tag is cut, the formula can be submitted to homebrew-core (netcode easily clears notability: 2.5k★). A ready-to-fill formula is drafted and attached in the PR discussion — it only needs the release tarball's sha256. Submitting to homebrew-core is a PR to
Homebrew/homebrew-corefrom an account, which I can't do autonomously — see the checklist below.🤖 Generated with Claude Code